<template>
	<view>
		
		<!-- <web-view :src="url"></web-view> -->
	</view>
</template>

<script>
  import { getkefe } from '@/api/user.js'
  export default {
    data() {
      return {
        urls: ''
      }
    },
    onLoad(options) {
      getkefe().then(res => {
        this.urls = res.data.mini_program_link;
        // 在获取到 this.url 后再调用 wx.openCustomerServiceChat()
        this.openCustomerServiceChat();
      }).catch(err => {
        console.error('Failed to fetch kefe:', err);
      });
    },
    methods: {
      openCustomerServiceChat() {
        if (this.urls) {
          wx.openCustomerServiceChat({
            extInfo: { url: this.urls },
            corpId: 'https://work.weixin.qq.com/kfid/kfcc68102c677b230df',
            success(res) {
				console.log('success',res)
			},
			fail(err) {
				console.log('err',err)
			}
          });
        } else {
          console.warn('this.urls is not ready yet.');
        }
      }
    }
  }
</script>